﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DAL;

namespace BLL
{
    public class BPhoneuser
    {
        private DPhoneuser _dPhoneuser = new DPhoneuser();

         /// <summary>
         /// 判断指定的手机号是否有记录
         /// </summary>
         /// <param name="phonenumber"></param>
         /// <returns></returns>
        public bool Exists(string phonenumber)
        {
            return _dPhoneuser.Exists(phonenumber);
        }

        public string GetUserAreaByPhoneNumber(string phonenumber)
        {
            return _dPhoneuser.GetUserAreaByPhoneNumber(phonenumber);
        }

        public bool IMEIExists(string imei)
        {
            return _dPhoneuser.IMEIExists(imei);
        }

        /// <summary>
        /// 按规定时间段的 登录人次，总人次，未登录人数，时间 统计
        /// </summary>
        /// <param name="dateType"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetReportByTime(int dateType, string strWhere)
        {
            return _dPhoneuser.GetReportByTime(dateType,strWhere);
        }


          public DataSet GetReportByRecommender(int[] rangeValue, string strWhere)
          {
              return _dPhoneuser.GetReportByRecommender(rangeValue, strWhere);
          }

        /// <summary>
        /// 按手机用户登录次数分段统计
        /// </summary>
        /// <param name="rangeValue"> 登录次数分段值</param>
        /// <param name="strWhere">其他条件</param>
        /// <returns></returns>
        public DataSet GetReportByLoginCount(int[] rangeValue,string strWhere)
        {
             return _dPhoneuser.GetReportByLoginCount(rangeValue, strWhere);
        }

        // 按用户交易次数统计
         public DataSet GetReportByTradeTimes(int[] rangeValue, string strWhere)
         {
             return _dPhoneuser.GetReportByTradeTimes(rangeValue, strWhere);
         }

        /// <summary>
        /// 得到列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetList(string strWhere)
        {
            return _dPhoneuser.GetList(strWhere);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.PhoneUserInfo model)
        {
           return _dPhoneuser.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateByPhoneNumber(string phoneNumber,int type,string lastLonginTime)
        {
            return _dPhoneuser.UpdateByNumber(phoneNumber,type,lastLonginTime);
        }
      
        public bool UpdateByIMEI(string imei, string version, string lastLonginTime)
        {
            return _dPhoneuser.UpdateByIMEI(imei, version, lastLonginTime);
        }

        public bool UpdateRecommender(string phoneNumber,string recommender)
        {
            return _dPhoneuser.UpdateRecommender(phoneNumber, recommender);
        }

        /// <summary>
        /// 根据手机号码得到数据
        /// </summary>
        /// <param name="PhoneNumber"></param>
        /// <returns></returns>
        public Model.PhoneUserInfo GetModelByPhoneNumber(string PhoneNumber)
        {

            return _dPhoneuser.GetModelByPhoneNumber(PhoneNumber);
        }

        public int  GetCount(string parameter, string parameterValue)
        {
            return _dPhoneuser.GetCount(parameter,parameterValue);
        }

        public bool Update(Model.PhoneUserInfo model)
        {
            return _dPhoneuser.Update(model);
        }

        public DataSet GetListByPage(int page, int pagesize,string parameter, string parameterValue)
        {
            return _dPhoneuser.GetListByPage(page, pagesize,parameter,parameterValue);
        }
 
    }
}
